const Joi = require('joi')

// ѧ��
var studentId = Joi.string().min(6).max(12).required().alphanum()
// ����
var passWord = Joi.string().min(6).required()
// ������
var someThingName = Joi.string().min(2).max(100).required()
// 0����1
var tinyInt = Joi.string().pattern(/^[01]$/).required()
// ���id
var id = Joi.string().min(1).max(9).alphanum().required()
// Date
var date = Joi.string().min(4).required()
// ҳ��
var page = Joi.string().min(1).max(4).required()
// ����
var details = Joi.string().min(2).max(50).required()
// Ȩ���ַ���
var rights = Joi.string().allow('')
// �绰
var phone = Joi.string().min(6).max(16)

var uid = Joi.string().required()
var type = Joi.number().required()
//������
// var regulator = Joi.string().min(2).max(50).required()

// ��¼��֤
const userSchema = {
	body: {
		studentid: studentId,
		password: passWord
	}
}

// �һ�������֤
const findUser = {
	body: {
		studentid: studentId,
		studentname: someThingName
	}
}

// �ύstudentid��֤
const deleteUser = {
	query: {
		studentid:studentId
    }
}

// �ύҳ����֤
const getlistSchema = {
	query: {
		page: page,
		pagesize: page
    }
}
// �༭�����û���������֤����
const addUserSchema = {
	body: {
		studentid: studentId,
		password: passWord,
		studentname: someThingName,
		classname: someThingName,
		college: someThingName,
		sex: tinyInt,
		phone:rights,
		detail:rights
	}
}
// �༭�û���֤
const editUserSchema = {
	body: {
		studentid: studentId,
		password: rights,
		studentname: someThingName,
		classname: someThingName,
		college: someThingName,
		sex: tinyInt,
		phone:rights,
		detail:rights
	},
	query: {
		studentid: studentId
	}
}
// ���Ӽܹ���֧��֤����
const addStructure = {
	body: {
		headid: studentId,
		name: someThingName,
// 		regulator: regulator,
		pid: id,
		introduce: details
	}
}
// �༭�ܹ���֧��֤����
const editStructure = {
	body: {
		headid: studentId,
		name: someThingName,
// 		regulator: regulator,
		pid: id,
		introduce: details
	},
	query: {
		id: passWord
	}
}
// ɾ���ܹ���֧��֤����
const deleteStructure = {
	query: {
		id: passWord
	}
}
// ���û����ӽ�ɫ��֤����
const editUserRole = {
	body: {
		user_id: studentId,
		role_id: rights,
// 		regulator: regulator
    }
}

// ��ȡ�û���ɫ��֤����
const getUserRole = {
	query: {
		user_id:studentId,
// 		regulator: regulator
	}
}

// ɾ���ܹ���ɫ��֤����
const deleteRole = {
	query: {
		roleid:id
	}
}
// ���ӽ�ɫ��֤����
const addRole = {
	body: {
		name: someThingName,
		details:rights,
// 		regulator: regulator
    }
}
// �༭��ɫ��֤����
const editRole = {
	body: {
		name: someThingName,
		details:rights,
		roleid:id,
// 		regulator: regulator
    }
}
// �༭��ɫȨ����֤����
const editRoleRight = {
	body: {
		right_id: rights,
		role_ids: id,
// 		regulator: regulator
    }
}
// ����id��ȡȨ��������֤����
const getRight = {
	query: {
		id
	}
}
// ����id����Ȩ��������Ϣ
const editRight = {
	query: {
		id
	},
	body: {
		name: someThingName,
		details,
// 		regulator: regulator,
		codes:someThingName,
		pid:id,
		type:page
	}
}
// ����Ȩ��
const addRight = {
	body: {
		name: someThingName,
		details,
// 		regulator: regulator,
		codes:someThingName,
		pid:id,
		type:page
	}
}
// �����豸
const addEquip = {
	body: {
		name: someThingName,
		num: id,
		photoid:someThingName,
		details
	}
}
// �����豸
const putEquip = {
	body: {
	    id,
		name: someThingName,
		num: id,
		photoid:someThingName,
		details
	}
}
const equipLend = {
    body: {
		student: someThingName,
		equipid: id,
		reason: details,
		timelimit: rights
	}
}
const equipReturn = {
    query: {
		id,
		equipid: id
	}
}
const auditEquipLend = {
    query: {
		progress: page,
		id,
		equipid: id
	}
}
const getUserLend = {
    query: {
		student: someThingName
	}
}
const getdata = {
	body: {
		uid,
		topic:uid,
		num:uid
	}
}
const getstatus = {
	body: {
		uid,
		topic:uid,
		type:type
	}
}
const postdata = {
	body: {
		uid,
		topic:uid,
		// num:uid
		msg:uid
	}
}
module.exports = {
	userSchema,
	findUser,
	addUserSchema,
	addStructure,
	deleteStructure,
	editUserSchema,
	editStructure,
	getlistSchema,
	editUserRole,
	deleteRole,
	addRole,
	editRoleRight,
	getRight,
	editRight,
	deleteUser,
	getUserRole,
	addRight,
	editRole,
	addEquip,
	putEquip,
	auditEquipLend,
	equipLend,
	equipReturn,
	getUserLend,
	getdata,
	postdata,
	getstatus
}